/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.asset.dto.borrow;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fuyao.cloud.asset.entity.borrow.Borrow;
import com.fuyao.cloud.asset.enums.BorrowStatusEnum;
import com.fuyao.cloud.common.core.enums.EnumContext;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 借用&归还表
 *
 * @author ly
 * @date 2022-01-06 10:37:40
 */
@Data
@ColumnWidth(30)
public class BorrowExcelDTO {

	@ApiModelProperty(value="办理状态")
	private String status;

	@ExcelProperty(value = "借用状态")
	private String type;

	@ExcelProperty(value = "借用单号")
	private String caseid;

	@ExcelProperty(value = "借用时间")
	private LocalDateTime borrowTime;

	@ExcelProperty(value = "借用人")
	private String borrowName;

	@ExcelProperty(value = "预计归还时间")
	private LocalDateTime forecastRemandTime;

	@ExcelProperty(value = "归还时间")
	private LocalDateTime realRemandTime;

	@ExcelProperty(value = "资产明细")
	private String detailed;

	public String getType() {
		return Borrow.BORROW.equals(type) ? "借用" : "领用";
	}

	public String getStatus(){
		BorrowStatusEnum borrowStatusEnum = EnumContext.getEnumByCode(status, BorrowStatusEnum.class);
		if (null != borrowStatusEnum) {
			return borrowStatusEnum.getName();
		}
		return StrUtil.EMPTY;
	}
}
